#include <stdio.h> 
void Transform(int n);
int main()
{
	int n;
	scanf_s("%d", &n);
	Transform(n);
	system("pause");
	return 0;
}
void Transform(int n)
{
	int num;
	if (n == 0)
		return;
	num = n % 8;
	Transform(n / 8);
	printf("%d", num);

}
